package com.shrct.businessprocess.customerservice.impl;

import com.shrct.businessprocess.customerservice.RCFaultWorkItem;
import com.shrct.businessprocess.customerservice.RCFaultWorkItemReport;
import com.shrct.businessprocess.customerservice.impl.RCFaultWorkItemImpl;
import com.shrct.businessprocess.customerservice.proxy.RCFaultWorkItemReportProxy;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.organization.impl.RCEmployeeImpl;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("RCFAULTWORKITEMREPORT_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "rcfaultworkitemreport")
public class RCFaultWorkItemReportImpl extends BaseModelObject implements RCFaultWorkItemReport {
  public RCFaultWorkItemReportImpl() {
    super();
  }
  
  public RCFaultWorkItemReportImpl(final RCFaultWorkItem workitem) {
    super();
    this.workitem = workitem;
  }
  
  @JoinColumn(name = "workitem_id")
  @ManyToOne(targetEntity = RCFaultWorkItemImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCFaultWorkItem workitem;
  
  public RCFaultWorkItem getWorkitem() {
    return this.workitem;
  }
  
  public RCFaultWorkItemReport setWorkitem(final RCFaultWorkItem workitem) {
    this.workitem = workitem;
    return this;			
    
  }
  
  private Date reportDate;
  
  public Date getReportDate() {
    return this.reportDate;
  }
  
  public RCFaultWorkItemReport setReportDate(final Date reportDate) {
    this.reportDate = reportDate;
    return this;			
    
  }
  
  private Date reportTime;
  
  public Date getReportTime() {
    return this.reportTime;
  }
  
  public RCFaultWorkItemReport setReportTime(final Date reportTime) {
    this.reportTime = reportTime;
    return this;			
    
  }
  
  private String reportComment;
  
  public String getReportComment() {
    return this.reportComment;
  }
  
  public RCFaultWorkItemReport setReportComment(final String reportComment) {
    this.reportComment = reportComment;
    return this;			
    
  }
  
  @JoinColumn(name = "recorder_id")
  @ManyToOne(targetEntity = RCEmployeeImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCEmployee recorder;
  
  public RCEmployee getRecorder() {
    return this.recorder;
  }
  
  public RCFaultWorkItemReport setRecorder(final RCEmployee recorder) {
    this.recorder = recorder;
    return this;			
    
  }
  
  public static RCFaultWorkItemReport create(final RCFaultWorkItem workitem, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.customerservice.RCFaultWorkItemReport rCFaultWorkItemReport = new com.shrct.businessprocess.customerservice.impl.RCFaultWorkItemReportImpl(
    	workitem
    );
    objectFactory.create(rCFaultWorkItemReport);
    return rCFaultWorkItemReport;			
    
  }
  
  public static RCFaultWorkItemReport createRCFaultWorkItemReportImpl(final RCFaultWorkItem workitem, final IObjectFactory objectFactory, final Procedure1<RCFaultWorkItemReport> init) {
    com.shrct.businessprocess.customerservice.RCFaultWorkItemReport rCFaultWorkItemReport = new com.shrct.businessprocess.customerservice.impl.RCFaultWorkItemReportImpl(
    	workitem
    );
    objectFactory.create(rCFaultWorkItemReport);
    init.apply(rCFaultWorkItemReport);
    
    return rCFaultWorkItemReport;			
    
  }
  
  public RCFaultWorkItemReportProxy toProxy() {
    com.shrct.businessprocess.customerservice.proxy.RCFaultWorkItemReportProxy proxy = new com.shrct.businessprocess.customerservice.proxy.RCFaultWorkItemReportProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
